<!DOCTYPE html>
<html class="x-admin-sm">

    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
      
    </head>
<body>
	<script type="text/javascript" src="./lib/layui/layui.js"></script>
	<div class="layui-form" style="margin-top: 20px">
	<div class="layui-form-item">
		<label class="layui-form-label">电脑编号</label>
		<div class="layui-input-inline">
			<input type="text" id="comNumber" name="comNumber" autocomplete="off"
				class="layui-input" style="width: 190px">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">所属阅览室</label>
		<div class="layui-input-inline">
			<input type="text" id="rRnum" name="rRnum" autocomplete="off"
				class="layui-input" style="width: 190px">
		</div>
	</div>
	
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" id="onc">立即提交</button>
		</div>
	</div>
	</div>
	
	
	<script type="text/javascript">
		
		layui.use('form', function() {
			var form = layui.form;
			var $ = layui.jquery; //引入jquery
			
			  $('#onc').on('click',function(){
			         
		          var url="/insertComputers";
		          var d={
		        	'comNumber':$("#comNumber").val(),
		            'rRnum':$("#rRnum").val()
		          }
		          $.post(url,d,function(res){
		            console.log(res);
		            if(res.success == false){
		              var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		              parent.layer.close(index); //再执行关闭   
		            }
		          },'json');
		        })
		
		});
	</script>

</body>

</html>